<?php

class reporteActions extends sfActions
{
  public function executeIndex(sfWebRequest $request)
  {
      
  }
  
  public function executeMostrarProveedoresBoleta(sfWebRequest $request)
    {
        $respuesta = BoletaPeer::doSelectProveedores();
        $this->getResponse()->setContent($respuesta);
        return sfView::NONE;
    }
    
  public function executeMostrarEstacionesBoleta(sfWebRequest $request)
    {
        $respuesta = BoletaPeer::doSelectEstaciones();
        $respuesta .= FacturaPeer::doSelectEstaciones();
        $respuesta .= detFacturaPeer::doSelectEstaciones();
        $auxiliar = explode('.',$respuesta);
        $auxiliar = array_unique($auxiliar);
        $respuesta = implode('.', $auxiliar);
        $this->getResponse()->setContent($respuesta);
        return sfView::NONE;
    }
   
  public function executeMostrarAeronavesBoleta(sfWebRequest $request)
    {
        $respuesta = BoletaPeer::doSelectAeronaves();
        $this->getResponse()->setContent($respuesta);
        return sfView::NONE;
    }
  
  public function executeMostrarVuelosBoleta(sfWebRequest $request)
    {
        $respuesta = BoletaPeer::doSelectVuelos();
        $this->getResponse()->setContent($respuesta);
        return sfView::NONE;
    }
    
  public function executeMostrarProveedoresFactura(sfWebRequest $request)
    {
        $respuesta = FacturaPeer::doSelectProveedores();
        $this->getResponse()->setContent($respuesta);
        return sfView::NONE;
    }
  
public function executePdf(sfWebRequest $request)
{
  $tipo = $request->getParameter('tipo');
  if($tipo=='')
  {
     $aux = $request->getParameter('BNE');
     $aux0 = $request->getParameter('BE');
     $aux1 = $request->getParameter('FC');
     $aux2 = $request->getParameter('FR');
     $aux3 = $request->getParameter('CE');
     $aux4 = $request->getParameter('CES');
     $aux5 = $request->getParameter('CP');
     $aux6 = $request->getParameter('CV');
     $aux7 = $request->getParameter('CEF');
     $aux8 = $request->getParameter('CPS');
     $aux9 = $request->getParameter('CA');
     $aux10 = $request->getParameter('SE');
     $aux11 = $request->getParameter('SV');
      if($aux != '')
      {
          $tipo = 'BoletaNE';
      }
      if($aux0 != '')
      {
          $tipo = 'BoletaE';
      }
      if($aux1 != '')
      {
          $tipo = 'FacturaC';
      }
      if($aux2 != '')
      {
          $tipo = 'FacturaR';
      }
      if($aux3 != '')
      {
          $tipo = 'ConsumoE';
      }
      if($aux4 != '')
      {
          $tipo = 'ConsumoES';
      }
      if($aux5 != '')
      {
          $tipo = 'ConsumoP';
      }
      if($aux6 != '')
      {
          $tipo = 'ConsumoV';
      }
      if($aux7 != '')
      {
          $tipo = 'CostoE';
      }
      if($aux8 != '')
      {
          $tipo = 'CostoP';
      }
      if($aux9 != '')
      {
          $tipo = 'CostoA';
      }
      if($aux10 != '')
      {
          $tipo = 'SuministroE';
      }
      if($aux11 != '')
      {
          $tipo = 'SuministroV';
      }
  }
  $clase = $tipo.'Peer';
  $config = sfTCPDFPluginConfigHandler::loadConfig();
 
  // pdf object
  $pdf = new sfTCPDF();
 
  // set document information
  $pdf->SetCreator(PDF_CREATOR);
  $pdf->SetAuthor('Nicola Asuni');
  $pdf->SetTitle('TCPDF Example 001');
  $pdf->SetSubject('TCPDF Tutorial');
  $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
 
  // set default header data
  $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
 
  // set header and footer fonts
  $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
  $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
 
  // set default monospaced font
  $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
 
  //set margins
  $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
  $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
  $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
  $pdf->setPageOrientation(PDF_PAGE_ORIENTATION);
 
  //set auto page breaks
  $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
 
  //set image scale factor
  $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
 
  // ---------------------------------------------------------
 
  // set default font subsetting mode
  $pdf->setFontSubsetting(true);
 
  // Set font
  // dejavusans is a UTF-8 Unicode font, if you only need to
  // print standard ASCII chars, you can use core fonts like
  // helvetica or times to reduce file size.
  $pdf->SetFont('dejavusans', '', 10, '', true);
 
// init pdf doc
    $pdf->AliasNbPages();
    $pdf->AddPage();
    $htmlcontent='';
    
    if($tipo=='Proveedor')
    {
        $htmlcontent = '<h1>Reporte de Proveedores</h1><table CELLSPACING="10" style="text-align:center"><tr><th style="background-color: #29088A;color: #ffffff;">RIF</th><th style="background-color: #29088A;color: #ffffff;">Nombre</th><th style="background-color: #29088A;color: #ffffff;">Teléfono</th><th style="background-color: #29088A;color: #ffffff;">Dirección</th><th style="background-color: #29088A;color: #ffffff;">&nbsp;&nbsp;Tipo&nbsp;&nbsp;</th><th style="background-color: #29088A;color: #ffffff;">U. Medida</th><th style="background-color: #29088A;color: #ffffff;">Moneda</th></tr>';
        $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        foreach ($vproducts as $vproduct) {
          $htmlcontent .= '<tr><td style="border: 1px dotted #999;">'.$vproduct->getRif().'</td><td style="border: 1px dotted #999;">'.$vproduct->getNombre().'</td><td style="border: 1px dotted #999;">'.$vproduct->getTlf().'</td><td style="border: 1px dotted #999;">'.$vproduct->getDireccion().'</td><td style="border: 1px dotted #999;">'.$vproduct->getTipo().'</td><td style="border: 1px dotted #999;">'.$vproduct->getUMedida1().'</td><td style="border: 1px dotted #999;">'.$vproduct->getMoneda1().'</td></tr>';
        }
        $htmlcontent .='</table>';
    }
    if($tipo=='Aeronave')
    {
        $htmlcontent = '<h1>Reporte de Aeronaves</h1><table CELLSPACING="10" style="text-align:center"><tr><th style="background-color: #29088A;color: #ffffff;">Serial</th><th style="background-color: #29088A;color: #ffffff;">Modelo</th><th style="background-color: #29088A;color: #ffffff;">Siglas</th><th style="background-color: #29088A;color: #ffffff;">Capacidad Tanque</th><th style="background-color: #29088A;color: #ffffff;">U. Medida</th></tr>';
        $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        foreach ($vproducts as $vproduct) {
          $htmlcontent .= '<tr><td style="border: 1px dotted #999;">'.$vproduct->getSerial().'</td><td style="border: 1px dotted #999;">'.$vproduct->getModelo().'</td><td style="border: 1px dotted #999;">'.$vproduct->getSiglas().'</td><td style="border: 1px dotted #999;">'.$vproduct->getCapTanque().'</td><td style="border: 1px dotted #999;">'.$vproduct->getUMedida().'</td></tr>';
        }
        $htmlcontent .='</table>';
    }
    if($tipo=='Vuelo')
    {
        $htmlcontent = '<h1>Reporte de Vuelos</h1><table CELLSPACING="10" style="text-align:center"><tr><th style="background-color: #29088A;color: #ffffff;">Número</th><th style="background-color: #29088A;color: #ffffff;">Tipo</th><th style="background-color: #29088A;color: #ffffff;">Origen</th><th style="background-color: #29088A;color: #ffffff;">Destino</th></tr>';
        $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        foreach ($vproducts as $vproduct) {
          $htmlcontent .= '<tr><td style="border: 1px dotted #999;">'.$vproduct->getNumVuelo().'</td><td style="border: 1px dotted #999;">'.$vproduct->getTipo().'</td><td style="border: 1px dotted #999;">'.$vproduct->getOrigen1().'</td><td style="border: 1px dotted #999;">'.$vproduct->getDestino1().'</td></tr>';
        }
        $htmlcontent .='</table>';
    }
    if($tipo=='Estacion')
    {
        $htmlcontent = '<h1>Reporte de Estaciones</h1><table CELLSPACING="10" style="text-align:center"><tr><th style="background-color: #29088A;color: #ffffff;">Código</th><th style="background-color: #29088A;color: #ffffff;">Siglas</th><th style="background-color: #29088A;color: #ffffff;">Descripción</th></tr>';
        $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        foreach ($vproducts as $vproduct) {
          $htmlcontent .= '<tr><td style="border: 1px dotted #999;">'.$vproduct->getCodigo().'</td><td style="border: 1px dotted #999;">'.$vproduct->getSiglas().'</td><td style="border: 1px dotted #999;">'.$vproduct->getDescripcion().'</td></tr>';
        }
        $htmlcontent .='</table>';
    }
    if($tipo=='Moneda')
    {
        $htmlcontent = '<h1>Reporte de Monedas</h1><table CELLSPACING="10" style="text-align:center"><tr><th style="background-color: #29088A;color: #ffffff;">Símbolo</th><th style="background-color: #29088A;color: #ffffff;">Descripción</th></tr>';
        $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        foreach ($vproducts as $vproduct) {
          $htmlcontent .= '<tr><td style="border: 1px dotted #999;">'.$vproduct->getSimbolo().'</td><td style="border: 1px dotted #999;">'.$vproduct->getDescripcion().'</td></tr>';
        }
        $htmlcontent .='</table>';
    }
    if($tipo=='CargoFactura')
    {
        $htmlcontent = '<h1>Reporte de Cargos Diversos</h1><table CELLSPACING="10" style="text-align:center"><tr><th style="background-color: #29088A;color: #ffffff;">Código del Sist. Financiero</th><th style="background-color: #29088A;color: #ffffff;">Descripción</th><th style="background-color: #29088A;color: #ffffff;">Tipo Combustible</th><th style="background-color: #29088A;color: #ffffff;">Impuesto</th><th style="background-color: #29088A;color: #ffffff;">Equipo</th><th style="background-color: #29088A;color: #ffffff;">Vuelo</th><th style="background-color: #29088A;color: #ffffff;">Estación</th></tr>';
        $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        foreach ($vproducts as $vproduct) {
          $htmlcontent .= '<tr><td style="border: 1px dotted #999;">'.$vproduct->getCodSistF().'</td><td style="border: 1px dotted #999;">'.$vproduct->getDescripcion().'</td><td style="border: 1px dotted #999;">'.$vproduct->getTipoComb().'</td><td style="border: 1px dotted #999;">'.$vproduct->getImpuesto1().'</td><td style="border: 1px dotted #999;">'.$vproduct->getEquipo1().'</td><td style="border: 1px dotted #999;">'.$vproduct->getVuelo1().'</td><td style="border: 1px dotted #999;">'.$vproduct->getEstacion1().'</td></tr>';
        }
        $htmlcontent .='</table>';
    }
    if($tipo=='Compania')
    {
        $htmlcontent = '<h1>Reporte de Compañias</h1><table CELLSPACING="10" style="text-align:center"><tr><th style="background-color: #29088A;color: #ffffff;">Nombre</th><th style="background-color: #29088A;color: #ffffff;">Descripción</th></tr>';
        $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        foreach ($vproducts as $vproduct) {
          $htmlcontent .= '<tr><td style="border: 1px dotted #999;">'.$vproduct->getNombre().'</td><td style="border: 1px dotted #999;">'.$vproduct->getDescripcion().'</td></tr>';
        }
        $htmlcontent .='</table>';
    }
    if($tipo=='Impuesto')
    {
        $htmlcontent = '<h1>Reporte de Impuestos</h1><table CELLSPACING="10" style="text-align:center"><tr><th style="background-color: #29088A;color: #ffffff;">Código Oracle</th><th style="background-color: #29088A;color: #ffffff;">Nombre</th><th style="background-color: #29088A;color: #ffffff;">Porcentaje</th></tr>';
        $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        foreach ($vproducts as $vproduct) {
          $htmlcontent .= '<tr><td style="border: 1px dotted #999;">'.$vproduct->getCodOracle().'</td><td style="border: 1px dotted #999;">'.$vproduct->getNombre().'</td><td style="border: 1px dotted #999;">'.$vproduct->getPorcentaje().'</td></tr>';
        }
        $htmlcontent .='</table>';
    }
    if($tipo=='TipoComb')
    {
        $htmlcontent = '<h1>Reporte de Tipos de Combustible</h1><table CELLSPACING="10" style="text-align:center"><tr><th style="background-color: #29088A;color: #ffffff;">Nombre</th><th style="background-color: #29088A;color: #ffffff;">Descripción</th></tr>';
        $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        foreach ($vproducts as $vproduct) {
          $htmlcontent .= '<tr><td style="border: 1px dotted #999;">'.$vproduct->getNombre().'</td><td style="border: 1px dotted #999;">'.$vproduct->getDescripcion().'</td></tr>';
        }
        $htmlcontent .='</table>';
    }
    if($tipo=='UnidMedida')
    {
        $htmlcontent = '<h1>Reporte de Unidades de Medida</h1><table CELLSPACING="10" style="text-align:center"><tr><th style="background-color: #29088A;color: #ffffff;">Símbolo</th><th style="background-color: #29088A;color: #ffffff;">Nombre</th><th style="background-color: #29088A;color: #ffffff;">Factor Conversión a Litros</th></tr>';
        $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        foreach ($vproducts as $vproduct) {
          $htmlcontent .= '<tr><td style="border: 1px dotted #999;">'.$vproduct->getSimbolo().'</td><td style="border: 1px dotted #999;">'.$vproduct->getNombre().'</td><td style="border: 1px dotted #999;">'.$vproduct->getConversion().'</td></tr>';
        }
        $htmlcontent .='</table>';
    }
    if($tipo=='TasaCamb')
    {
        $htmlcontent = '<h1>Reporte de Unidades de Medida</h1><table CELLSPACING="10" style="text-align:center"><tr><th style="background-color: #29088A;color: #ffffff;">Fecha</th><th style="background-color: #29088A;color: #ffffff;">Moneda</th><th style="background-color: #29088A;color: #ffffff;">Se Convierte a</th><th style="background-color: #29088A;color: #ffffff;">Tasa de Cambio</th></tr>';
        $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        foreach ($vproducts as $vproduct) {
          $htmlcontent .= '<tr><td style="border: 1px dotted #999;">'.$vproduct->getFecha().'</td><td style="border: 1px dotted #999;">'.$vproduct->getMoneda11().'</td><td style="border: 1px dotted #999;">'.$vproduct->getMoneda21().'</td><td style="border: 1px dotted #999;">'.$vproduct->getMonto().'</td></tr>';
        }
        $htmlcontent .='</table>';
    }
    if($tipo=='PrecioComb')
    {
        $htmlcontent = '<h1>Reporte de Precios de Combustible</h1><table CELLSPACING="10" style="text-align:center"><tr><th style="background-color: #29088A;color: #ffffff;">De la fecha</th><th style="background-color: #29088A;color: #ffffff;">A la Fecha</th><th style="background-color: #29088A;color: #ffffff;">Proveedor</th><th style="background-color: #29088A;color: #ffffff;">Estacion</th><th style="background-color: #29088A;color: #ffffff;">U. Medida</th><th style="background-color: #29088A;color: #ffffff;">Moneda</th><th style="background-color: #29088A;color: #ffffff;">Precio</th></tr>';
        $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        foreach ($vproducts as $vproduct) {
          $htmlcontent .= '<tr><td style="border: 1px dotted #999;">'.$vproduct->getFecha1().'</td><td style="border: 1px dotted #999;">'.$vproduct->getFecha2().'</td><td style="border: 1px dotted #999;">'.$vproduct->getProveedor1().'</td><td style="border: 1px dotted #999;">'.$vproduct->getEstacion1().'</td><td style="border: 1px dotted #999;">'.$vproduct->getUMedida().'</td><td style="border: 1px dotted #999;">'.$vproduct->getMoneda2().'</td><td style="border: 1px dotted #999;">'.$vproduct->getPrecio().'</td></tr>';
        }
        $htmlcontent .='</table>';
    }
    if($tipo=='Boleta')
    {
        $htmlcontent = '<h1>Reporte de Boletas</h1><table CELLSPACING="10" style="text-align:center"><tr><th style="background-color: #29088A;color: #ffffff;">Proveedor</th><th style="background-color: #29088A;color: #ffffff;">Fecha</th><th style="background-color: #29088A;color: #ffffff;">Número</th><th style="background-color: #29088A;color: #ffffff;">Factura</th><th style="background-color: #29088A;color: #ffffff;">Vuelo</th><th style="background-color: #29088A;color: #ffffff;">Estación Suministro</th><th style="background-color: #29088A;color: #ffffff;">Aeronave</th><th style="background-color: #29088A;color: #ffffff;">Tipo Combustible</th><th style="background-color: #29088A;color: #ffffff;">Total Combustible</th><th style="background-color: #29088A;color: #ffffff;">Tiempo de Tanqueo</th></tr>';
        $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        foreach ($vproducts as $vproduct) {
          $htmlcontent .= '<tr><td style="border: 1px dotted #999;">'.$vproduct->getProveedor().'</td><td style="border: 1px dotted #999;">'.$vproduct->getFecha().'</td><td style="border: 1px dotted #999;">'.$vproduct->getNumBoleta().'</td><td style="border: 1px dotted #999;">'.$vproduct->getFactura1().'</td><td style="border: 1px dotted #999;">'.$vproduct->getVuelo().'</td><td style="border: 1px dotted #999;">'.$vproduct->getEstacionSum1().'</td><td style="border: 1px dotted #999;">'.$vproduct->getAeronave1().'</td><td style="border: 1px dotted #999;">'.$vproduct->getTipoComb().'</td><td style="border: 1px dotted #999;">'.$vproduct->getTotal().' '.$vproduct->getUMedida().'</td><td style="border: 1px dotted #999;">'.$vproduct->getHoraTotal().'</td></tr>';
        }
        $htmlcontent .='</table>';
    }
    if($tipo=='Factura')
    {
        $htmlcontent = '<h1>Reporte de Facturas</h1><table CELLSPACING="10" style="text-align:center"><tr><th style="background-color: #29088A;color: #ffffff;">Número</th><th style="background-color: #29088A;color: #ffffff;">Fecha</th><th style="background-color: #29088A;color: #ffffff;">Proveedor</th><th style="background-color: #29088A;color: #ffffff;">Fecha Transmisión</th><th style="background-color: #29088A;color: #ffffff;">Número Transmisión</th><th style="background-color: #29088A;color: #ffffff;">Moneda</th><th style="background-color: #29088A;color: #ffffff;">Estación</th><th style="background-color: #29088A;color: #ffffff;">Empresa</th><th style="background-color: #29088A;color: #ffffff;">Tiene Reclamo?</th><th style="background-color: #29088A;color: #ffffff;">Cantidad Total Suministro</th><th style="background-color: #29088A;color: #ffffff;">Total Factura</th></tr>';
        $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        foreach ($vproducts as $vproduct) {
          $htmlcontent .= '<tr><td style="border: 1px dotted #999;">'.$vproduct->getNumero().'</td><td style="border: 1px dotted #999;">'.$vproduct->getFecha().'</td><td style="border: 1px dotted #999;">'.$vproduct->getProveedor().'</td><td style="border: 1px dotted #999;">'.$vproduct->getFechaTrans1().'</td><td style="border: 1px dotted #999;">'.$vproduct->getNumTrans1().'</td><td style="border: 1px dotted #999;">'.$vproduct->getMoneda1().'</td><td style="border: 1px dotted #999;">'.$vproduct->getEstacion1().'</td><td style="border: 1px dotted #999;">'.$vproduct->getEmpresa1().'</td><td style="border: 1px dotted #999;">'.$vproduct->getReclamo1().'</td><td style="border: 1px dotted #999;">'.$vproduct->getCantTotal().' '.$vproduct->getUMedida().'</td><td style="border: 1px dotted #999;">'.$vproduct->getTotal().'</td></tr>';
        }
        $htmlcontent .='</table>';
    }
    if($tipo=='Reclamo')
    {
        $htmlcontent = '<h1>Reporte de Reclamos</h1><table CELLSPACING="10" style="text-align:center"><tr><th style="background-color: #29088A;color: #ffffff;">Número</th><th style="background-color: #29088A;color: #ffffff;">Fecha</th><th style="background-color: #29088A;color: #ffffff;">Numero Factura</th><th style="background-color: #29088A;color: #ffffff;">Descripción</th><th style="background-color: #29088A;color: #ffffff;">Estatus</th><th style="background-color: #29088A;color: #ffffff;">Numero Aprobación</th><th style="background-color: #29088A;color: #ffffff;">Fecha aprobación</th><th style="background-color: #29088A;color: #ffffff;">Número Nota</th><th style="background-color: #29088A;color: #ffffff;">Fecha Nota</th><th style="background-color: #29088A;color: #ffffff;">Tipo Nota</th><th style="background-color: #29088A;color: #ffffff;">Monto Nota</th></tr>';
        $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        foreach ($vproducts as $vproduct) {
          $htmlcontent .= '<tr><td style="border: 1px dotted #999;">'.$vproduct->getNumBoleta().'</td><td style="border: 1px dotted #999;">'.$vproduct->getFecha().'</td><td style="border: 1px dotted #999;">'.$vproduct->getNumeroFactura().'</td><td style="border: 1px dotted #999;">'.$vproduct->getDescripcion().'</td><td style="border: 1px dotted #999;">'.$vproduct->getEstatus().'</td><td style="border: 1px dotted #999;">'.$vproduct->getNumAprob().'</td><td style="border: 1px dotted #999;">'.$vproduct->getFechaAprob().'</td><td style="border: 1px dotted #999;">'.$vproduct->getNumNota().'</td><td style="border: 1px dotted #999;">'.$vproduct->getFechaNota().'</td><td style="border: 1px dotted #999;">'.$vproduct->getTipoNota().'</td><td style="border: 1px dotted #999;">'.$vproduct->getMontoNota().'</td></tr>';
        }
        $htmlcontent .='</table>';
    }
    if($tipo=='BoletaNE')
    {
        $proveedor = $request->getParameter('proveedorB');
        $desde = $request->getParameter('desdeB');
        $hasta = $request->getParameter('hastaB');
        $htmlcontent = '<h1>Reporte de Boletas No Enlazadas</h1><table CELLSPACING="10" style="text-align:center"><tr><th style="background-color: #29088A;color: #ffffff;">Número</th><th style="background-color: #29088A;color: #ffffff;">Fecha</th><th style="background-color: #29088A;color: #ffffff;">Proveedor</th><th style="background-color: #29088A;color: #ffffff;">Vuelo</th><th style="background-color: #29088A;color: #ffffff;">Estación Sum</th><th style="background-color: #29088A;color: #ffffff;">Total Sum</th><th style="background-color: #29088A;color: #ffffff;">Unid Medida</th><th style="background-color: #29088A;color: #ffffff;">Tipo Comb</th></tr>';
        $htmlcontent.= BoletaPeer::doSelectBoletasNEProveedor($proveedor, $desde, $hasta);
        $htmlcontent .='</table>';
    }
    if($tipo=='BoletaE')
    {
        $proveedor = $request->getParameter('proveedorB');
        $desde = $request->getParameter('desdeB');
        $hasta = $request->getParameter('hastaB');
        $htmlcontent = '<h1>Reporte de Boletas Enlazadas</h1><table CELLSPACING="10" style="text-align:center"><tr><th style="background-color: #29088A;color: #ffffff;">Número</th><th style="background-color: #29088A;color: #ffffff;">Factura</th><th style="background-color: #29088A;color: #ffffff;">Fecha</th><th style="background-color: #29088A;color: #ffffff;">Proveedor</th><th style="background-color: #29088A;color: #ffffff;">Vuelo</th><th style="background-color: #29088A;color: #ffffff;">Estación Sum</th><th style="background-color: #29088A;color: #ffffff;">Total Sum</th><th style="background-color: #29088A;color: #ffffff;">Unid Medida</th><th style="background-color: #29088A;color: #ffffff;">Tipo Comb</th></tr>';
        $htmlcontent.= BoletaPeer::doSelectBoletasEProveedor($proveedor, $desde, $hasta);
        $htmlcontent .='</table>';
    }
    if($tipo=='FacturaC')
    {
        $proveedor = $request->getParameter('proveedorF');
        $desde = $request->getParameter('desdeF');
        $hasta = $request->getParameter('hastaF');
        $htmlcontent = '<h1>Reporte de Facturas Correctas</h1><table CELLSPACING="10" style="text-align:center"><tr><th style="background-color: #29088A;color: #ffffff;">Número</th><th style="background-color: #29088A;color: #ffffff;">Fecha</th><th style="background-color: #29088A;color: #ffffff;">Proveedor</th><th style="background-color: #29088A;color: #ffffff;">Fecha Transmisión</th><th style="background-color: #29088A;color: #ffffff;">Número Transmisión</th><th style="background-color: #29088A;color: #ffffff;">Cantidad Total Suministro</th><th style="background-color: #29088A;color: #ffffff;">Monto Suministro</th><th style="background-color: #29088A;color: #ffffff;">Monto Cargos</th><th style="background-color: #29088A;color: #ffffff;">Total Factura</th></tr>';
        $htmlcontent.= FacturaPeer::doSelectFacturasCorrectas($proveedor, $desde, $hasta);
        $htmlcontent .='</table>';
    }
    if($tipo=='FacturaR')
    {
        $proveedor = $request->getParameter('proveedorF');
        $desde = $request->getParameter('desdeF');
        $hasta = $request->getParameter('hastaF');
        $htmlcontent = '<h1>Reporte de Facturas con Reclamos</h1><table CELLSPACING="10" style="text-align:center"><tr><th style="background-color: #29088A;color: #ffffff;">Número</th><th style="background-color: #29088A;color: #ffffff;">Fecha</th><th style="background-color: #29088A;color: #ffffff;">Proveedor</th><th style="background-color: #29088A;color: #ffffff;">Número Reclamo</th><th style="background-color: #29088A;color: #ffffff;">Cantidad Total Suministro</th><th style="background-color: #29088A;color: #ffffff;">Monto Suministro</th><th style="background-color: #29088A;color: #ffffff;">Monto Cargos</th><th style="background-color: #29088A;color: #ffffff;">Total Factura</th></tr>';
        $htmlcontent.= FacturaPeer::doSelectFacturasIncorrectas($proveedor, $desde, $hasta);
        $htmlcontent .='</table>';
    }
    if($tipo=='ConsumoE')
    {
        $desde = $request->getParameter('desdeCC');
        $hasta = $request->getParameter('hastaCC');
        $aeronave = $request->getParameter('aeronaveCC');
        $htmlcontent = '<h1>Reporte de Suministro de Combustible por Aeronave</h1><table CELLSPACING="10" style="text-align:center"><tr><th style="background-color: #29088A;color: #ffffff;">Aeronave</th><th style="background-color: #29088A;color: #ffffff;">Fecha</th><th style="background-color: #29088A;color: #ffffff;">Total de Suministro</th><th style="background-color: #29088A;color: #ffffff;">Tipo Combustible</th></tr>';
        //$auxiliarFacturas = FacturaPeer::doSelectFechasFacturas($desde, $hasta);
        //$auxiliarBoletas = BoletaPeer::doSelectBoletasFecha($estacion, $desde, $hasta);
        //$fechasBoletas= explode('.',$auxiliarBoletas);
        //$fechasFacturas = explode('.', $auxiliarFacturas);
        //$fechasFacturas = array_unique($fechasFacturas);
        //$fechasBoletas = array_unique($fechasBoletas);
        //$rangoFechas = array_merge($fechasFacturas, $fechasBoletas);
        //$rangoFechas = array_unique($rangoFechas);
        //$estaciones = BoletaPeer::doSelectEstaciones();
        //$estaciones .= FacturaPeer::doSelectEstaciones();
        //$estaciones .= detFacturaPeer::doSelectEstaciones();
        //$estaciones = explode('.',$estaciones);
        //$estaciones = array_unique($estaciones);
        //for($i=0;$i<sizeof($rangoFechas);$i++)
        //{
          //  if($rangoFechas[$i]!='')
            //{
              //  if($estacion!='')
                //{
                  //$consumoF = FacturaPeer::doSelectConsumoByFecha($rangoFechas[$i], $estacion);
                  //$consumoB = BoletaPeer::doSelectConsumoByFecha($rangoFechas[$i],$estacion);
                  //$consumo = (float)$consumoF + (float)$consumoB;
                  //if($consumo!='0')
                  //{
                   //   $htmlcontent .='<tr><td style="border: 1px dotted #999;">'.EstacionPeer::doSelectByCodigo($estacion).'</td><td style="border: 1px dotted #999;">'.$rangoFechas[$i].'</td><td style="border: 1px dotted #999;">'.$consumo.'</td><td style="border: 1px dotted #999;"></td></tr>';
                  //}
                //}
                //else
                //{
                  //  for($j=0;$j<sizeof($estaciones);$j++)
                    //{
                      //  if($estaciones[$j]!='')
                        //{
                          //  $estacion = explode(',',$estaciones[$j]);
                            //$consumoF = FacturaPeer::doSelectConsumoByFecha($rangoFechas[$i], $estacion[0]);
                            //$consumoB = BoletaPeer::doSelectConsumoByFecha($rangoFechas[$i], $estacion[0]);
                            //$consumo = (float)$consumoF + (float)$consumoB;
                            //if($consumo!='0')
                            //{
                             // $htmlcontent .='<tr><td style="border: 1px dotted #999;">'.$estacion[1].'</td><td style="border: 1px dotted #999;">'.$rangoFechas[$i].'</td><td style="border: 1px dotted #999;">'.$consumo.'</td><td style="border: 1px dotted #999;"></td></tr>'; 
                            //}
                        //}
                    //}
                //}
                //$estacion = $request->getParameter('estacionCC');
            //}
        //}
        //$htmlcontent.= FacturaPeer::doSelectFacturasIncorrectas($proveedor, $desde, $hasta);
        $htmlcontent .='</table>';
    }
    if($tipo=='ConsumoES')
    {
        $desde = $request->getParameter('desdeCC');
        $hasta = $request->getParameter('hastaCC');
        $estacion = $request->getParameter('estacionCC');
        $htmlcontent = '<h1>Reporte de Suministro de Combustible por Estación</h1><table CELLSPACING="10" style="text-align:center"><tr><th style="background-color: #29088A;color: #ffffff;">Estación</th><th style="background-color: #29088A;color: #ffffff;">Fecha</th><th style="background-color: #29088A;color: #ffffff;">Total de Suministro</th><th style="background-color: #29088A;color: #ffffff;">Tipo Combustible</th></tr>';
        $auxiliarFacturas = FacturaPeer::doSelectFechasFacturas($desde, $hasta);
        $auxiliarBoletas = BoletaPeer::doSelectBoletasFecha($estacion, $desde, $hasta);
        $fechasBoletas= explode('.',$auxiliarBoletas);
        $fechasFacturas = explode('.', $auxiliarFacturas);
        $fechasFacturas = array_unique($fechasFacturas);
        $fechasBoletas = array_unique($fechasBoletas);
        $rangoFechas = array_merge($fechasFacturas, $fechasBoletas);
        $rangoFechas = array_unique($rangoFechas);
        $estaciones = BoletaPeer::doSelectEstaciones();
        $estaciones .= FacturaPeer::doSelectEstaciones();
        $estaciones .= detFacturaPeer::doSelectEstaciones();
        $estaciones = explode('.',$estaciones);
        $estaciones = array_unique($estaciones);
        for($i=0;$i<sizeof($rangoFechas);$i++)
        {
            if($rangoFechas[$i]!='')
            {
                if($estacion!='')
                {
                  $consumoF = FacturaPeer::doSelectConsumoByFecha($rangoFechas[$i], $estacion);
                  $consumoB = BoletaPeer::doSelectConsumoByFecha($rangoFechas[$i],$estacion);
                  $consumo = (float)$consumoF + (float)$consumoB;
                  if($consumo!='0')
                  {
                      $htmlcontent .='<tr><td style="border: 1px dotted #999;">'.EstacionPeer::doSelectByCodigo($estacion).'</td><td style="border: 1px dotted #999;">'.$rangoFechas[$i].'</td><td style="border: 1px dotted #999;">'.$consumo.'</td><td style="border: 1px dotted #999;"></td></tr>';
                  }
                }
                else
                {
                    for($j=0;$j<sizeof($estaciones);$j++)
                    {
                        if($estaciones[$j]!='')
                        {
                            $estacion = explode(',',$estaciones[$j]);
                            $consumoF = FacturaPeer::doSelectConsumoByFecha($rangoFechas[$i], $estacion[0]);
                            $consumoB = BoletaPeer::doSelectConsumoByFecha($rangoFechas[$i], $estacion[0]);
                            $consumo = (float)$consumoF + (float)$consumoB;
                            if($consumo!='0')
                            {
                              $htmlcontent .='<tr><td style="border: 1px dotted #999;">'.$estacion[1].'</td><td style="border: 1px dotted #999;">'.$rangoFechas[$i].'</td><td style="border: 1px dotted #999;">'.$consumo.'</td><td style="border: 1px dotted #999;"></td></tr>'; 
                            }
                        }
                    }
                }
                $estacion = $request->getParameter('estacionCC');
            }
        }
        //$htmlcontent.= FacturaPeer::doSelectFacturasIncorrectas($proveedor, $desde, $hasta);
        $htmlcontent .='</table>';
    }

    // output     
    $pdf->writeHTML($htmlcontent, true, 0);
  // ---------------------------------------------------------
 
  // Close and output PDF document
  // This method has several options, check the source code documentation for more information.
  $pdf->Output('example_001.pdf', 'I');
 
  // Stop symfony process
  throw new sfStopException();
}

public function executeExcel(sfWebRequest $request)
{
// Create new PHPExcel object
    $objPHPExcel = new sfPhpExcel();
    // Set active sheet index to the first sheet, so Excel opens this as thefirst sheet
    $objPHPExcel->setActiveSheetIndex(0);
    // Set properties
    $objPHPExcel->getProperties()->setCreator("Maarten Balliauw");
    $objPHPExcel->getProperties()->setLastModifiedBy("Maarten Balliauw");
    $objPHPExcel->getProperties()->setTitle("Office 2007 XLSX TestDocument");
    $objPHPExcel->getProperties()->setSubject("Office 2007 XLSX TestDocument");
    $objPHPExcel->getProperties()->setDescription("Test document for Office2007 XLSX, generated using PHP classes.");
    $objPHPExcel->getProperties()->setKeywords("office 2007 openxml php");
    $objPHPExcel->getProperties()->setCategory("Test result file");
    // Set default font

    $objPHPExcel->getActiveSheet()->getDefaultStyle()->getFont()->setName('Arial');

    $objPHPExcel->getActiveSheet()->getDefaultStyle()->getFont()->setSize(12);
    
    $default_border = array(
                      'style' => PHPExcel_Style_Border::BORDER_THIN,
                      'color' => array('rgb'=>'ffffff'));
    $style_header = array(
        'borders' => array(
            'bottom' => $default_border,
            'left' => $default_border,
            'top' => $default_border,
            'right' => $default_border,
        ),
        'fill' => array(
            'type' => PHPExcel_Style_Fill::FILL_SOLID,
            'color' => array('rgb'=>'29088A'),
        ),
        'font' => array(
            'bold' => true,
            'color' => array('rgb'=>'ffffff'),
        )
    ); 
    
    
     $objPHPExcel->setActiveSheetIndex(0);
     
     $tipo = $request->getParameter('tipo');
    $clase = $tipo.'Peer';
     if($tipo=='Proveedor')
     {
         $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'RIF');
         $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Nombre');
         $objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Tlf');
         $objPHPExcel->getActiveSheet()->SetCellValue('D1', 'Dirección');
         $objPHPExcel->getActiveSheet()->SetCellValue('E1', 'Tipo');
         $objPHPExcel->getActiveSheet()->SetCellValue('F1', 'Unidad de medida');
         $objPHPExcel->getActiveSheet()->SetCellValue('G1', 'Moneda');
         $objPHPExcel->getActiveSheet()->getStyle('A1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('B1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('C1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('D1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('E1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('F1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('G1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('B1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('C1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('D1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('E1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('F1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('G1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setAutoSize(true);
         
         $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        $i = 2;
        foreach ($vproducts as $vproduct) {
             $objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$vproduct->getRif());
             $objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$vproduct->getNombre());
             $objPHPExcel->getActiveSheet()->SetCellValue('C'.$i, $vproduct->getTlf());
             $objPHPExcel->getActiveSheet()->SetCellValue('D'.$i,$vproduct->getDireccion());
             $objPHPExcel->getActiveSheet()->SetCellValue('E'.$i,$vproduct->getTipo() );
             $objPHPExcel->getActiveSheet()->SetCellValue('F'.$i,$vproduct->getUMedida());
             $objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$vproduct->getMoneda());
             $i++;
        }
     }
     
     if($tipo=='Aeronave')
     {
         $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Serial');
         $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Modelo');
         $objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Siglas');
         $objPHPExcel->getActiveSheet()->SetCellValue('D1', 'Capacidad del Tanque');
         $objPHPExcel->getActiveSheet()->SetCellValue('E1', 'Unidad de Medida');
         $objPHPExcel->getActiveSheet()->getStyle('A1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('B1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('C1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('D1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('E1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('B1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('C1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('D1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('E1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setAutoSize(true);
         $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setAutoSize(true);
         
         $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        $i = 2;
        foreach ($vproducts as $vproduct) {
             $objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$vproduct->getSerial());
             $objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$vproduct->getModelo());
             $objPHPExcel->getActiveSheet()->SetCellValue('C'.$i, $vproduct->getSiglas());
             $objPHPExcel->getActiveSheet()->SetCellValue('D'.$i,$vproduct->getCapTanque());
             $objPHPExcel->getActiveSheet()->SetCellValue('E'.$i,$vproduct->getUMedida() );
             $i++;
        }
     }
     
     if($tipo=='Vuelo')
     {
         $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Número');
         $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Tipo');
         $objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Origen');
         $objPHPExcel->getActiveSheet()->SetCellValue('D1', 'Destino');
         $objPHPExcel->getActiveSheet()->getStyle('A1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('B1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('C1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('D1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('B1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('C1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('D1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);

         
         $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        $i = 2;
        foreach ($vproducts as $vproduct) {
             $objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$vproduct->getNumVuelo());
             $objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$vproduct->getTipo());
             $objPHPExcel->getActiveSheet()->SetCellValue('C'.$i, $vproduct->getOrigen1());
             $objPHPExcel->getActiveSheet()->SetCellValue('D'.$i,$vproduct->getDestino1());
             $i++;
        }
     }
     
     if($tipo=='Estacion')
     {
         $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Código');
         $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Siglas');
         $objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Descripción');
         $objPHPExcel->getActiveSheet()->getStyle('A1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('B1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('C1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('B1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('C1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);

         
         $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        $i = 2;
        foreach ($vproducts as $vproduct) {
             $objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$vproduct->getCodigo());
             $objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$vproduct->getSiglas());
             $objPHPExcel->getActiveSheet()->SetCellValue('C'.$i, $vproduct->getDescripcion());
             $i++;
        }
     }
     
     if($tipo=='Moneda')
     {
         $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Símbolo');
         $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Descripción');
         $objPHPExcel->getActiveSheet()->getStyle('A1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('B1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('B1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);

         
         $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        $i = 2;
        foreach ($vproducts as $vproduct) {
             $objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$vproduct->getSimbolo());
             $objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$vproduct->getDescripcion());
             $i++;
        }
     }
     
     if($tipo=='CargoFactura')
     {
         $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Código del Sistema Financiero');
         $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Descripción');
         $objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Tipo Combustible');
         $objPHPExcel->getActiveSheet()->SetCellValue('D1', 'Impuesto');
         $objPHPExcel->getActiveSheet()->SetCellValue('E1', 'Equipo');
         $objPHPExcel->getActiveSheet()->SetCellValue('F1', 'Vuelo');
         $objPHPExcel->getActiveSheet()->SetCellValue('G1', 'Estación');
         $objPHPExcel->getActiveSheet()->getStyle('A1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('B1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('C1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('D1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('E1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('F1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('G1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('B1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('C1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('D1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('E1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('F1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('G1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setAutoSize(true);
         $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setAutoSize(true);

         
         $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        $i = 2;
        foreach ($vproducts as $vproduct) {
             $objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$vproduct->getCodSistF());
             $objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$vproduct->getDescripcion());
             $objPHPExcel->getActiveSheet()->SetCellValue('C'.$i, $vproduct->getTipoComb());
             $objPHPExcel->getActiveSheet()->SetCellValue('D'.$i,$vproduct->getImpuesto1());
             $objPHPExcel->getActiveSheet()->SetCellValue('E'.$i,$vproduct->getEquipo1() );
             $objPHPExcel->getActiveSheet()->SetCellValue('F'.$i,$vproduct->getVuelo1());
             $objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$vproduct->getEstacion1());
             $i++;
        }
     }
     
     if($tipo=='Compania')
     {
         $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Nombre');
         $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Descripción');
         $objPHPExcel->getActiveSheet()->getStyle('A1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('B1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('B1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);

         
         $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        $i = 2;
        foreach ($vproducts as $vproduct) {
             $objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$vproduct->getNombre());
             $objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$vproduct->getDescripcion());
             $i++;
        }
     }
     
     if($tipo=='Impuesto')
     {
         $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Código Oracle');
         $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Nombre');
         $objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Porcentaje');
         $objPHPExcel->getActiveSheet()->getStyle('A1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('B1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('C1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('B1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('C1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setAutoSize(true);

         
         $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        $i = 2;
        foreach ($vproducts as $vproduct) {
             $objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$vproduct->getCodOracle());
             $objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$vproduct->getNombre());
             $objPHPExcel->getActiveSheet()->SetCellValue('C'.$i, $vproduct->getPorcentaje());
             $i++;
        }
     }
     
     if($tipo=='TipoComb')
     {
         $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Nombre');
         $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Descripción');
         $objPHPExcel->getActiveSheet()->getStyle('A1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('B1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('B1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);

         
         $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        $i = 2;
        foreach ($vproducts as $vproduct) {
             $objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$vproduct->getNombre());
             $objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$vproduct->getDescripcion());
             $i++;
        }
     }
     
     if($tipo=='UnidMedida')
     {
         $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Símbolo');
         $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Nombre');
         $objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Factor de Conversión');
         $objPHPExcel->getActiveSheet()->getStyle('A1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('B1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('C1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('B1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('C1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setAutoSize(true);

         
         $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        $i = 2;
        foreach ($vproducts as $vproduct) {
             $objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$vproduct->getSimbolo());
             $objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$vproduct->getNombre());
             $objPHPExcel->getActiveSheet()->SetCellValue('C'.$i, $vproduct->getConversion());
             $i++;
        }
     }
     
     if($tipo=='TasaCamb')
     {
         $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Fecha');
         $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Moneda');
         $objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Se convierte a');
         $objPHPExcel->getActiveSheet()->SetCellValue('D1', 'Tasa de Cambio');
         $objPHPExcel->getActiveSheet()->getStyle('A1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('B1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('C1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('D1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('B1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('C1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('D1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setAutoSize(true);
         $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setAutoSize(true);

         
         $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        $i = 2;
        foreach ($vproducts as $vproduct) {
             $objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$vproduct->getFecha());
             $objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$vproduct->getMoneda1());
             $objPHPExcel->getActiveSheet()->SetCellValue('C'.$i,$vproduct->getMoneda2());
             $objPHPExcel->getActiveSheet()->SetCellValue('D'.$i,$vproduct->getMonto());
             $i++;
        }
     }
     
     if($tipo=='PrecioComb')
     {
         $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'De la Fecha');
         $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'A la Fecha');
         $objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Proveedor');
         $objPHPExcel->getActiveSheet()->SetCellValue('D1', 'Estacion');
         $objPHPExcel->getActiveSheet()->SetCellValue('E1', 'Unidad de Medida');
         $objPHPExcel->getActiveSheet()->SetCellValue('F1', 'Moneda');
         $objPHPExcel->getActiveSheet()->SetCellValue('G1', 'Precio');
         $objPHPExcel->getActiveSheet()->getStyle('A1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('B1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('C1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('D1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('E1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('F1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('G1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('B1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('C1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('D1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('E1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('F1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('G1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setAutoSize(true);

         
         $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        $i = 2;
        foreach ($vproducts as $vproduct) {
             $objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$vproduct->getFecha1());
             $objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$vproduct->getFecha2());
             $objPHPExcel->getActiveSheet()->SetCellValue('C'.$i, $vproduct->getProveedor());
             $objPHPExcel->getActiveSheet()->SetCellValue('D'.$i,$vproduct->getEstacion1());
             $objPHPExcel->getActiveSheet()->SetCellValue('E'.$i,$vproduct->getUMedida() );
             $objPHPExcel->getActiveSheet()->SetCellValue('F'.$i,$vproduct->getMoneda1());
             $objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$vproduct->getPrecio());
             $i++;
        }
     }
     
     if($tipo=='Boleta')
     {
         $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Proveedor');
         $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Fecha');
         $objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Número');
         $objPHPExcel->getActiveSheet()->SetCellValue('D1', 'Factura');
         $objPHPExcel->getActiveSheet()->SetCellValue('E1', 'Vuelo');
         $objPHPExcel->getActiveSheet()->SetCellValue('F1', 'Estacion de suministro');
         $objPHPExcel->getActiveSheet()->SetCellValue('G1', 'Aeronave');
         $objPHPExcel->getActiveSheet()->SetCellValue('H1', 'Tipo de Combustible');
         $objPHPExcel->getActiveSheet()->SetCellValue('I1', 'Total de Combustible');
         $objPHPExcel->getActiveSheet()->SetCellValue('J1', 'Tiempo de Tanqueo');
         $objPHPExcel->getActiveSheet()->getStyle('A1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('B1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('C1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('D1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('E1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('F1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('G1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('H1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('I1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('J1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('B1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('C1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('D1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('E1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('F1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('G1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('H1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('I1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('J1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setAutoSize(true);
         $objPHPExcel->getActiveSheet()->getColumnDimension('H')->setAutoSize(true);
         $objPHPExcel->getActiveSheet()->getColumnDimension('I')->setAutoSize(true);
         $objPHPExcel->getActiveSheet()->getColumnDimension('J')->setAutoSize(true);

         
         $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        $i = 2;
        foreach ($vproducts as $vproduct) {
             $objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$vproduct->getProveedor());
             $objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$vproduct->getFecha());
             $objPHPExcel->getActiveSheet()->SetCellValue('C'.$i, $vproduct->getNumero());
             $objPHPExcel->getActiveSheet()->SetCellValue('D'.$i,$vproduct->getFactura());
             $objPHPExcel->getActiveSheet()->SetCellValue('E'.$i,$vproduct->getVuelo() );
             $objPHPExcel->getActiveSheet()->SetCellValue('F'.$i,$vproduct->getEstacionSum());
             $objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$vproduct->getAeronave());
             $objPHPExcel->getActiveSheet()->SetCellValue('H'.$i,$vproduct->getTipoComb());
             $objPHPExcel->getActiveSheet()->SetCellValue('I'.$i,$vproduct->getTotal());
             $objPHPExcel->getActiveSheet()->SetCellValue('J'.$i,$vproduct->getHoraTotal());
             $i++;
        }
     }
     
     if($tipo=='Factura')
     {
         $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Número');
         $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Fecha');
         $objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Proveedor');
         $objPHPExcel->getActiveSheet()->SetCellValue('D1', 'Fecha de Transmisión');
         $objPHPExcel->getActiveSheet()->SetCellValue('E1', 'Número de Transmisión');
         $objPHPExcel->getActiveSheet()->SetCellValue('F1', 'Moneda');
         $objPHPExcel->getActiveSheet()->SetCellValue('G1', 'Estación');
         $objPHPExcel->getActiveSheet()->SetCellValue('H1', 'Empresa');
         $objPHPExcel->getActiveSheet()->SetCellValue('I1', 'Tiene Reclamo?');
         $objPHPExcel->getActiveSheet()->SetCellValue('J1', 'Cantidad total de suministro');
         $objPHPExcel->getActiveSheet()->SetCellValue('K1', 'Total de Factura');
         $objPHPExcel->getActiveSheet()->getStyle('A1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('B1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('C1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('D1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('E1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('F1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('G1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('H1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('I1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('J1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('K1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('B1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('C1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('D1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('E1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('F1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('G1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('H1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('I1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('J1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('K1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setAutoSize(true);
         $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setAutoSize(true);
         $objPHPExcel->getActiveSheet()->getColumnDimension('J')->setAutoSize(true);
         $objPHPExcel->getActiveSheet()->getColumnDimension('K')->setAutoSize(true);

         
         $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        $i = 2;
        foreach ($vproducts as $vproduct) {
             $objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$vproduct->getNumero());
             $objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$vproduct->getFecha());
             $objPHPExcel->getActiveSheet()->SetCellValue('C'.$i, $vproduct->getProveedor());
             $objPHPExcel->getActiveSheet()->SetCellValue('D'.$i,$vproduct->getFechaTrans());
             $objPHPExcel->getActiveSheet()->SetCellValue('E'.$i,$vproduct->getNumTrans() );
             $objPHPExcel->getActiveSheet()->SetCellValue('F'.$i,$vproduct->getMoneda());
             $objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$vproduct->getEstacion());
             $objPHPExcel->getActiveSheet()->SetCellValue('H'.$i,$vproduct->getEmpresa());
             $objPHPExcel->getActiveSheet()->SetCellValue('I'.$i,$vproduct->getReclamo1());
             $objPHPExcel->getActiveSheet()->SetCellValue('J'.$i,$vproduct->getCantTotal());
             $objPHPExcel->getActiveSheet()->SetCellValue('K'.$i,$vproduct->getTotal());
             
             $i++;
        }
     }
     
     if($tipo=='Reclamo')
     {
         $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Número');
         $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Fecha');
         $objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Número Factura');
         $objPHPExcel->getActiveSheet()->SetCellValue('D1', 'Descripción');
         $objPHPExcel->getActiveSheet()->SetCellValue('E1', 'Estatus');
         $objPHPExcel->getActiveSheet()->SetCellValue('F1', 'Número Aprobación');
         $objPHPExcel->getActiveSheet()->SetCellValue('G1', 'Fecha Aprobación');
         $objPHPExcel->getActiveSheet()->SetCellValue('H1', 'Número Nota');
         $objPHPExcel->getActiveSheet()->SetCellValue('I1', 'Fecha Nota');
         $objPHPExcel->getActiveSheet()->SetCellValue('J1', 'Tipo Nota');
         $objPHPExcel->getActiveSheet()->SetCellValue('K1', 'Monto nota');
         $objPHPExcel->getActiveSheet()->getStyle('A1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('B1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('C1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('D1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('E1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('F1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('G1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('H1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('I1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('J1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('K1')->applyFromArray( $style_header );
         $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('B1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('C1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('D1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('E1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('F1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('G1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('H1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('I1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('J1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('K1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setAutoSize(true);
         $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setAutoSize(true);
         $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setAutoSize(true);
         $objPHPExcel->getActiveSheet()->getColumnDimension('G')->setAutoSize(true);

         
         $c = new Criteria();
        $vproducts = $clase::doSelect($c);
        $i = 2;
        foreach ($vproducts as $vproduct) {
             $objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$vproduct->getNumero());
             $objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$vproduct->getFecha());
             $objPHPExcel->getActiveSheet()->SetCellValue('C'.$i, $vproduct->getNumeroFactura());
             $objPHPExcel->getActiveSheet()->SetCellValue('D'.$i,$vproduct->getDescripcion());
             $objPHPExcel->getActiveSheet()->SetCellValue('E'.$i,$vproduct->getEstatus() );
             $objPHPExcel->getActiveSheet()->SetCellValue('F'.$i,$vproduct->getNumAprob());
             $objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$vproduct->getFechaAprob());
             $objPHPExcel->getActiveSheet()->SetCellValue('H'.$i,$vproduct->getNumNota());
             $objPHPExcel->getActiveSheet()->SetCellValue('I'.$i,$vproduct->getFechaNota());
             $objPHPExcel->getActiveSheet()->SetCellValue('J'.$i,$vproduct->getTipoNota());
             $objPHPExcel->getActiveSheet()->SetCellValue('K'.$i,$vproduct->getMontoNota());
             
             $i++;
        }
     }
     
    // Save Excel 2007 file
    $objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
    
    $file_name = 'Reporte'.$tipo.'.xls';
    $this->getResponse()->clearHttpHeaders();

    $this->getResponse()->setHttpHeader('Content-Disposition','attachment;filename='.$file_name);
    $this->getResponse()->setHttpHeader('Pragma', '');
    $this->getResponse()->setHttpHeader('Cache-Control', '');
    $this->getResponse()->setContentType('application/msexcel'); 
    $this->getResponse()->sendHttpHeaders();


    $this->renderText($objWriter->save('php://output'));

    return sfView::NONE;
}

}
